﻿using DtoFw;
using DtoFw.Query;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Service;
using System.Collections.Generic;

namespace SceneEvidenceAPI.Controllers
{
    /// <summary>
    /// 第三方接口
    /// </summary>
    [Route("api/party")]
    [AllowAnonymous]
    public class PartyController : BaseController
    {
        private readonly PartyService _partyService;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="partyService"></param>
        public PartyController(PartyService partyService)
        {
            this._partyService = partyService;
        }

        /// <summary>
        /// 查询区域
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpGet("{organId}/queryAreas")]
        public BaseGenericResult<List<AreaQueryDto>> QueryAreas(long organId)
        {
            return _partyService.QueryAreas(organId);
        }


        /// <summary>
        /// 查询物品所属区域
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpGet("{eveidenceNo}/{organId}/queryEviNo")]
        public BaseGenericResult<EvidenceToAreaDto> GetEvidenceByEviNo(string eveidenceNo, long organId)
        {
            return _partyService.GetEvidenceByEviNo(eveidenceNo, organId);
        }

        /// <summary>
        /// 查询所有流转记录
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpGet("{eveidenceNo}/{organId}/{page}/{pageSize}/queryWarnCheckout")]
        public BaseGenericResult<Pager<WarnCheckoutDto>> GetWarnCheckout(string eveidenceNo, long organId, int page, int pageSize)
        {
            return _partyService.GetWarnCheckout(eveidenceNo, organId, page, pageSize);
        }

        /// <summary>
        /// 物证朔源查询
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpGet("{eveidenceNo}/{organId}/querySource")]
        public BaseGenericResult<SourceEviDto> GetSource(string eveidenceNo, long organId)
        {
            return _partyService.GetSource(eveidenceNo, organId);
        }


        /// <summary>
        /// Rfid报警
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost("reader/report")]
        public BaseGenericResult<bool> GetRfid(RfidDto dto)
        {
            return _partyService.GetRfid(dto);
        }

        /// <summary>
        /// Rfid读写器
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost("reader/rfid")]
        public BaseGenericResult<bool> ReaderRfidInfo(List<RfidReaderDto> dto)
        {
            return _partyService.ReaderRfidInfo(dto);
        }

        /// <summary>
        /// 盘点
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost("reader/rfid/task")]
        public BaseGenericResult<TaskInfoDto> RfidTask(BaseQuery dto)
        {
            return _partyService.RfidTask(dto);
        }

        /// <summary>
        /// 发卡机读取
        /// </summary>
        /// <returns></returns>
        [HttpGet("rfidreader/readepc")]
        public BaseGenericResult<string> Readepc()
        {
            return _partyService.Readepc();
        }

        /// <summary>
        /// 发卡机读取
        /// </summary>
        /// <returns></returns>
        [HttpPost("handheld/taskdown")]
        public BaseGenericResult<string> Taskdown(HaiKangPanDianDto dto)
        {
            return _partyService.Taskdown(dto);
        }

        /// <summary>
        /// Rfid打印
        /// </summary>
        /// <returns></returns>
        [HttpPost("rfidprinter/propertyprint")]
        public BaseGenericResult<string> Propertyprint(HaiKangPrintDto dto)
        {
            return _partyService.Propertyprint(dto);
        }


        /// <summary>
        /// 海康获取要开门的数据
        /// </summary>
        /// <returns></returns>
        [HttpGet("queryTransEvidences")]
        public HaiKangTransDto QueryTransEvidences(string tranNo)
        {
            return _partyService.QueryTransEvidences(tranNo);
        }
    }
}


